from libs.read_config import read_config
from libs.zabbix_poller import zabbix_poller
from sys import exit
import gtk
import gobject

class zabbix_notify:
	def __init__(self):
		try:
			self.configuration = read_config()
		except:
			exit(1)

		try:
			gobject.threads_init()
			zpoller = zabbix_poller(self.configuration)
			zpoller.start()
		except Exception as e:
			print "Unexpected error on thread creation: ", str(e)
			exit()

		try:
			gtk.main()
		except:
			print "\nTerminating..."
			zpoller.terminate()
			exit(0)

if __name__ == "__main__":
	zn = zabbix_notify()	
